<template>
  <div id="member_balance_v2">
    <c-title :hide="false" :text="balanceLang" tolink="detailed"></c-title>
    <div class="background_box" v-if="show"></div>
    <div class="contenbox">
      <!-- 余额 -->
      <template v-if="!name">
        <div class="detail">
          <div class="txt">我的{{ balanceLang }}（元)</div>
          <div class="balance">{{ dataInfo.balance }}</div>
          <div class="detailBox" v-if="dataInfo.balance_button.length > 0">
            <div
              class="detailBox_btn"
              @click="tourl(item.url)"
              :class="item.title == '充值' ? 'recharge' : item.title == '转账' ? 'transfer' : 'withdraw'"
              v-for="item in dataInfo.balance_button"
              :key="item.title"
            >
              {{ item.title }}
            </div>
          </div>
          <div class="activityTxt" v-if="dataInfo.recharge_activity && dataInfo.recharge_activity.activity">
            充值活动：
            <div class="txt_for" v-for="(item, index) in dataInfo.recharge_activity.activity" :key="index">
              充值满{{ item.enough }}元赠送{{ item.give }}{{ dataInfo.recharge_activity.type == "0" ? "元" : "%" }}{{ index != dataInfo.recharge_activity.activity.length - 1 ? "，" : "" }}
            </div>
          </div>
        </div>
        <div class="balanceDetail" v-if="dataInfo.balance_log.length > 0">
          <div class="title">
            <div class="title_left">{{ balanceLang }}明细</div>
            <div class="title_right" @click="tourl('detailed')">
              查看全部
              <van-icon name="arrow" color="#878787" />
            </div>
          </div>
          <div class="balanceDetail_lis" v-for="(item, index) in dataInfo.balance_log" :key="index">
            <div class="balanceDetail_lis_top">
              <div class="balanceDetail_lis_top_left">{{ item.service_type_name }}</div>
              <div class="price">{{ item.type == 1 ? "+" : "" }}{{ item.change_money }}</div>
            </div>
            <div class="balanceDetail_lis_bottom">
              <div class="time">{{ item.created_at }}</div>
              <div class="balanceTxt">{{ balanceLang }}：{{ item.new_money }}</div>
            </div>
          </div>
        </div>
        <div class="rests" v-if="dataInfo.other">
          <div class="title">其他功能</div>
          <div class="lis">
            <div class="restslis" @click="transformingLoveV" v-for="(item, index) in dataInfo.other" :key="index">
              <div class="image">
                <img :src="item.img" alt="" />
              </div>
              <div class="txt">转化{{ item.title }}</div>
            </div>
          </div>
        </div>
      </template>
      <!-- 猫崽积分 数据统计-->
      <template v-else>
        <div class="detail" >
          <div class="txt">我的{{balanceLang}}</div>
          <div class="balance" style="margin-top: 0.625rem;">{{ dataInfo.point }}</div>
          <div class="detailBox" style="margin-top: 1.4rem;">
            <div
              class="detailBox_btn"
              @click="tourlEclogicalPoint(item.url,{status:item.status})"
              :class="item.title == '转让' ? 'recharge' : item.title == '打赏' ? 'transfer' : 'withdraw'"
              v-for="item in dataInfo.point_buttons"
              :key="item.title"
            >
              {{ item.title }}
            </div>
          </div>
        </div>
        <div class="balanceDetail" v-if=" dataInfo && dataInfo.point_log">
          <div class="title">
            <div class="title_left">{{balanceLang}}明细</div>
            <div class="title_right" @click="tourl('ecologicalPointDetailed')">
              查看全部
              <van-icon name="arrow" color="#878787" />
            </div>
          </div>
          <div class="balanceDetail_lis" v-for="(item, index) in dataInfo.point_log" :key="index">
            <div class="balanceDetail_lis_top">
              <div class="balanceDetail_lis_top_left">{{ item.source_name }}</div>
              <div class="price">{{item.change_type == 1?'+':'-'}}{{ item.amount }}</div>
            </div>
            <div class="balanceDetail_lis_bottom">
              <div class="time">{{ item.created_at }}</div>
              <div class="balanceTxt">剩余:{{ item.present }}</div>
            </div>
          </div>
        </div>
        <div class="rests" >
          <div class="title">其他功能</div>
          <div class="lis">
            <div class="restslis" @click="transformingTo(item.id)" v-for="item in nameOther" :key="item.id">
              <div class="image_name">
                <img :src="item.img" alt="" />
              </div>
              <div class="txt">{{ item.title }}</div>
            </div>
          </div>
        </div>
        <div class="dataStatistics" >
          <div class="title">数据统计</div>
          <div class="navDateList">
            <div class="lis" :class="Navlis == 'day' ? 'isDay' : ''" @click="tapNav('day')">今日</div>
            <div class="lis" :class="Navlis == 'week' ? 'isDay' : ''" @click="tapNav('week')">本周</div>
            <div class="lis" :class="Navlis == 'month' ? 'isDay' : ''" @click="tapNav('month')">本月</div>
          </div>
          <div class="list">
            <div class="left">平台总资产额</div>
            <div class="right">{{point_statistics.grand_member_point}}</div>
          </div>
          <div class="list">
            <div class="left">互转额</div>
            <div class="right">{{point_statistics.cycle_transfer_point}}</div>
          </div>
          <div class="list">
            <div class="left">打赏额</div>
            <div class="right">{{point_statistics.cycle_reward_point}}</div>
          </div>
          <div class="list">
            <div class="left">让利额</div>
            <div class="right">{{point_statistics.cycle_tactful_point}}</div>
          </div>
          <div class="list" v-if="Navlis == 'day'">
            <div class="left">发放总数</div>
            <div class="right">{{point_statistics.grand_airdrop_point}}</div>
          </div>
          <div class="list" v-if="Navlis == 'day'">
            <div class="left">当天空投数量</div>
            <div class="right">{{point_statistics.today_airdrop_point}}</div>
          </div>
          <div class="list" v-if="Navlis == 'day'">
            <div class="left">剩余待发放数量</div>
            <div class="right">{{point_statistics.surplus_airdrop_point}}</div>
          </div>
          <div class="list" v-if="Navlis == 'day'">
            <div class="left">当天销毁数量</div>
            <div class="right">{{point_statistics.today_destroy_point}}</div>
          </div>
          <div class="list">
            <div class="left">销毁总数</div>
            <div class="right">{{point_statistics.grand_destroy_point}}</div>
          </div>
        </div>
      </template>
    </div>
  </div>
</template>
<script>
import memberBanlanceController from "./member_banlanceController_v2";
export default memberBanlanceController;
</script>
<style lang="scss" scoped>
.van-dialog__message{
  padding: 0 !important;
}
.icon-balance_p {
  color: #f15353;
}

.icon-balance_a {
  color: #6cbf6a;
}

.icon-balance_b {
  color: #fac337;
}

.icon-balance_c {
  color: #069ce7;
}

.background_box {
  color: #382c0a;
  background-color: #fff;
  background-image: -webkit-gradient(linear, left top, left bottom, from(var(--themeBaseColor)), to(#f5f5f5));
  background-image: -webkit-linear-gradient(var(--themeBaseColor), #f5f5f5);
  background-image: linear-gradient(var(--themeBaseColor), #f5f5f5);
  min-height: 12.125rem;
  padding: 1.5938rem 1.0938rem 0 1.0938rem;
}

.contenbox {
  padding: 0 0.625rem;

  .dataStatistics {
    padding: 0.75rem;
    background: #fff;
    margin-top: 0.5rem;

    .title {
      font-weight: bold;
      font-size: 1rem;
      text-align: left;
      margin-bottom: 1.4375rem;
    }

    .navDateList {
      display: flex;
      justify-content: flex-start;
      align-items: center;
      margin-bottom: 0.5rem;

      .lis {
        font-size: 0.75rem;
        line-height: 1.03rem;
        margin-right: 2rem;
        padding: 0.25rem 0.75rem;
      }

      .lis:last-child {
        margin-right: 0;
      }

      .isDay {
        border-radius: 0.78rem;
        background: var(--themeBaseColor);
        color: #fff;
      }
    }

    .list {
      height: 3rem;
      border-bottom: 1px solid #e7e7e7;
      display: flex;
      align-items: center;
      justify-content: space-between;

      .left {
        width: 50%;
        font-size: 0.81rem;
        font-weight: 500;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        text-align: left;
      }

      .right {
        width: 50%;
        font-size: 0.81rem;
        font-weight: bold;
        color: #f20606;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        text-align: right;
      }
    }

    .list:last-child {
      border-bottom: none;
    }
  }

  .rests {
    min-height: 6.875rem;
    background: #fff;
    border-radius: 0.625rem;
    margin-top: 0.625rem;
    padding: 0.9688rem 0.9063rem;

    .title {
      font-weight: bold;
      font-size: 1rem;
      text-align: left;
      margin-bottom: 1.4375rem;
    }

    .lis {
      display: flex;
      flex-wrap: wrap;

      .restslis {
        width: 25%;
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;

        .image_name {
          width: 2.75rem;
          height: 2.75rem;
          margin-bottom: 0.7188rem;

          img {
            width: 100%;
            height: 100%;
          }
        }

        .image {
          width: 1.5938rem;
          height: 1.4688rem;
          margin-bottom: 0.7188rem;

          img {
            width: 100%;
            height: 100%;
          }
        }

        .txt {
          width: 100%;
        }
      }
    }
  }

  .balanceDetail {
    margin-top: 0.625rem;
    border-radius: 0.625rem;
    background: #fff;
    padding: 0.9375rem 0.875rem;

    .balanceDetail_lis {
      border-bottom: 1px solid #f6f6f6;
      padding: 0.9375rem 0;

      .balanceDetail_lis_top,
      .balanceDetail_lis_bottom {
        display: flex;
        justify-content: space-between;
      }

      .balanceDetail_lis_bottom {
        margin-top: 0.625rem;
      }

      .balanceTxt {
        font-weight: 400;
        color: #666;
        font-size: 0.6875rem;
      }

      .time {
        color: #999;
        font-size: 0.6875rem;
      }

      .balanceDetail_lis_top_left {
        font-size: 0.8125rem;
        font-weight: 500;
      }

      .price {
        font-weight: 500;
        color: #f20606;
        font-size: 0.8125rem;
      }
    }

    .title {
      display: flex;
      justify-content: space-between;
      align-items: center;

      .title_left {
        font-size: 1rem;
        color: #333;
        font-weight: bold;
      }

      .title_right {
        color: #878787;
        font-weight: 400;
        font-size: 0.6875rem;
        display: flex;
        align-items: center;
      }
    }
  }

  .detail {
    margin-top: -8rem;
    background: #fff;
    border-radius: 0.625rem;
    // min-height: 11.25rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 1.25rem 1.4063rem 0.625rem 1.4063rem;

    .txt {
      font-size: 0.8125rem;
      color: #666;
    }

    .balance {
      font-size: 1.375rem;
      font-weight: bold;
      color: #333;
    }

    .activityTxt {
      width: 100%;
      text-align: left;
      font-weight: 400;
      color: #f20606;
      font-size: 0.625rem;
      margin-top: 0.9063rem;
      display: flex;
      flex-wrap: wrap;
    }

    .detailBox {
      display: flex;
      width: 100%;
      margin-top: 2.4rem;
      justify-content: space-between;

      .detailBox_btn {
        padding: 0.625rem 1.9375rem;
        border-radius: 0.3125rem;
        font-size: 0.75rem;
        font-weight: 400;
      }

      .recharge {
        border: 1px solid var(--themeBaseColor);
        color: var(--themeBaseColor);
        // margin-right: 1.5rem;
      }

      .transfer {
        border: 1px solid #b3b3b3;
        color: #262626;
        // margin-right: 1.5rem;
      }

      .withdraw {
        background: var(--themeBaseColor);
        color: #fff;
      }
    }
  }
}
</style>